<?php
/**
 * Created by PhpStorm.
 * User: 快定
 * Date: 2021/9/18
 * Time: 14:06
 */
/*监听demo频道，打印收到的信息*/
function process($redis, $chan, $msg)
{
    var_dump($msg);
}

$redis = new Redis();
$redis->connect('127.0.0.1', '6379');
// 就加了这个，而且必须是在connect之后设置
$redis->setOption(Redis::OPT_READ_TIMEOUT, -1);
$redis->subscribe(array('demo'), 'process');